﻿package Chapter01;
// 將 StepIntoJava.java 內容替換為下列代碼即可運行
//======================================================================
//public class StepIntoJava {
//	public static void main(String[] args) {
//		Ch01Shuffle app = new Ch01Shuffle();
//		app.run();
//	}	
//}
//======================================================================

// 隨機排列組合練習
//
// 重點：隨機數的運用、字串的組合、if條件判斷
public class Shuffle {
	public void run() {
		String[] persons = {"曾于修","林志玲","金城武","木村拓哉","安心亞"};
		String[] places = {"廁所","火星","太平洋","烏魯木齊","警察局"};
		String[] doings = {"挖鼻孔","睡大覺","吃便當","唱情歌","磨牙齒"};
		
		for (int i = 0; i < 10; i++) {
			int personIndex = (int)(Math.random() * persons.length);
			int placeIndex = (int)(Math.random() * places.length);
			int doingIndex = (int)(Math.random() * doings.length);
			if (personIndex == 0) {
				System.out.print("我，");
			}
			System.out.println(persons[personIndex]+"在"+places[placeIndex]+doings[doingIndex]);
		}
	}
}
